import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { viteMockServe } from "vite-plugin-mock";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  server: {
    host: true, // 使服务器监听所有地址
    port: 5173, // 指定端口号（可选）

    proxy: {
      "/api": "http://localhost:9999", // 代理到 Express 服务器
    },
  },
  define: {
    "process.env": process.env,
  },
  resolve: {
    alias: {
      "@": "/src",
    },
  },
  css: {
    preprocessorOptions: {
      less: {
        javascriptEnabled: true, // 支持内联 JavaScript
        modifyVars: {
          // 更改主题
        },
      },
    },
  },
});
